<template>
	<view>
		<view class="headView bg-gradual-green">
			<view class="avatorView">
				<view class="avator cu-avatar round margin-left" style="background-image:url(https://pic4.zhimg.com/80/v2-6afa72220d29f045c15217aa6b275808_1440w.jpg?source=1940ef5c);"></view>
			</view>
			<view class="nickName">
				{{user.userRealName}}
			</view>

			<view class="score">
				<text class="cuIcon-selection"></text>
				扶贫积分：{{user.userScore}}.00
			</view>
		</view>
		<view class="contentView">
			<view class="orderContentView">
				<view class="goodsContentView">
					<view class="goodsContentLabel infoLabel">
						<text class="cuIcon-cart" style="margin-right: 10upx;"></text>
						商品订单状态
					</view>
					<view class="goodsContentItems contentItems">
						<view class="goodsItem items" v-for="goodsItem in goodsContentItems" hover-class="navigator-hover" @click="goTo" :data-url="goodsItem.url">
							<view class="icon">
								<image :src="goodsItem.icon" style="width: 90upx; height: 90upx;" mode=""></image>
							</view>
							<view class="" style="margin-left: 4upx;">{{goodsItem.name}}</view>
						</view>


					</view>
				</view>
				<view class="hotelContentView" style="margin-top: 30upx;">
					<view class="hotelContentLabel infoLabel">
						<text class="cuIcon-home"></text>
						民宿订单状态
					</view>
					<view class="hotelContentItems contentItems">
						<view class="hotelItem items" v-for="hotelItem in hotelContentItems" hover-class="navigator-hover" @click="goTo" :data-url="hotelItem.url">
							<view class="icon">
								<image :src="hotelItem.icon" style="width: 90upx; height: 90upx;" mode=""></image>
							</view>
							<view class="" style="margin-left: upx;">{{hotelItem.name}}</view>
						</view>
					</view>
				</view>
			</view>
			<view class="otherContentView">
				<view class="" style="padding-top: 20upx;padding-bottom: 20upx; padding-left: 10upx;" v-for="item in otherContentItems" @click="goTo" :data-url="item.url">
					<view style="display: flex;">
						<view class="icon">
							<image :src="item.icon" style="width: 50upx; height: 50upx;margin-left: 15upx;" mode=""></image>
						</view>
						<view class="name" style="font-size: 16px; color: #808080;margin-top: 5upx;padding-left: 15upx;">
							{{item.name}}
						</view>
					</view>
				</view>
			</view>


		</view>

		<view class="copyright">
			<view>Made By WangLeishu & Guided By Pr. ShaoXiufeng</view>
			<view style="margin-top: 5upx;">Beijing City University</view>
		</view>
	</view>
</template>

<script>
	import { getScoreByOpenId } from '../../api/userAPI.js'
	import { isLogin } from '../../utils/util.js'
	export default {
		data() {
			return {
				user: {},
				goodsContentItems: [{
						id: 1,
						icon: '../../static/unpaid.png',
						name: '待支付',
						url: '../orderList/orderList?status=0'
					},
					{
						id: 2,
						icon: '../../static/waitGoods.png',
						name: '待发货',
						url: '../orderList/orderList?status=1'
					},
					{
						id: 3,
						icon: '../../static/waitSpend.png',
						name: '待取货',
						url: '../orderList/orderList?status=6'
					},
					{
						id: 4,
						icon: '../../static/evaluate.png',
						name: '待评价',
						url: '../orderList/orderList?status=7'
					},
				],
				hotelContentItems: [{
						id: 1,
						icon: '../../static/unpaid.png',
						name: '待支付',
						url: '../hOrderList/hOrderList?status=0'
					},
					{
						id: 2,
						icon: '../../static/hotel.png',
						name: '待入住',
						url: '../hOrderList/hOrderList?status=1'
					},
					{
						id: 3,
						icon: '../../static/accomplish.png',
						name: '已完成',
						url: '../hOrderList/hOrderList?status=3'
					},
					{
						id: 4,
						icon: '../../static/evaluate.png',
						name: '待评价',
						url: '../hOrderList/hOrderList?status=3'
					},
				],
				otherContentItems: [{
						id: 1,
						icon: '../../static/my_n.png',
						name: '切换用户',
						url: '../login/login?hot=1'
					},
					{
						id: 2,
						icon: '../../static/kefu1.png',
						name: '吐槽反馈',
						url: ''
					},
				]
			}
		},
		methods: {
			goTo(event) {
				uni.navigateTo({
					url:event.currentTarget.dataset.url
				})
			}
		},
		onLoad() {
			
		},
		onShow(){
			const app = getApp();
			if(isLogin()){
				this.user = app.globalData.user
				console.log("this.user: ", this.user);
				getScoreByOpenId(this.user.userOpenid).then(resp => {
					this.user.userScore = resp.result
				})
			}
			
			
		}
	}
</script>

<style>
	@import url("./mine.css");
</style>
